<template>
	<el-form ref="form" :model="LoginForm" label-width="80px">
	  <el-form-item label="账号">
	    <el-input v-model="LoginForm.username"></el-input>
	  </el-form-item>
	  <el-form-item label="密码">
	    <el-input type="password" v-model="LoginForm.password"></el-input>
	  </el-form-item>
	  <el-form-item>
	    <el-button type="primary" @click="login()">立即登录</el-button>
	    <el-button>取消</el-button>
	  </el-form-item>
	</el-form>
</template>

<script>
	export default {
		created() {
			this.login()
		},
		data() {
		  return {
			LoginForm: {
			  username: 'admin',
			  password: '123456'
			}
		  }
		},
		methods: {
			async login(){
				const {data:res} =  this.$ajax.post('http://www.code.test/api/login/login',this.LoginForm)
				// console.log(this.$ajax);
				// console.log(1111);
				if(res.data == 1){
					this.$msg.success(res.msg)
					this.$router.push('/')
				}else{
					this.$msg.error('123123')
				}
				// this.$msg.success('123123')
				
			}
		}
	}
</script>

<style>
</style>